;;;
;;; JaCoLiB
;;; Copyright (C) 2008 Alessandro Serra
;;; 
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;; 
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;; 
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;;

;;;; Created on 2008-07-02 10:44:17

(in-package :jacolib)

;
; Javascript Shell
;

(defmacro js-get (shell key)
  `(shell-get ,shell (parenscript::symbol-to-js ,key)))
(defmacro js-unset (shell key)
  `(shell-unset ,shell (parenscript::symbol-to-js ,key)))
(defmacro js-set (shell key obj)
  `(shell-set ,shell (parenscript::symbol-to-js ,key) ,obj))
(defmacro js-eval (shell code)
  `(shell-eval ,shell (parenscript:ps ,code)))
(defmacro js-eval* (shell code)
  `(shell-eval ,shell (parenscript:ps* ,code)))

;
; Javascript Callback Shell
;

(defmacro js-callback-get (key)
  `(js-get *callback-shell* ',key))
(defmacro js-callback-unset (key)
  `(js-unset *callback-shell* ',key))
(defmacro js-callback-set ( key obj)
  `(js-set *callback-shell* ',key ,obj))
(defmacro js-callback-eval ( code)
  `(js-eval *callback-shell* ,code))
(defmacro js-callback-eval* ( code)
  `(js-eval* *callback-shell* ,code))

